package com.guigu.liuyunan.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.liuyunan.mapper.ClinicdepartmentMapper;
import com.guigu.liuyunan.mapper.DiseaselibraryMapper;
import com.guigu.liuyunan.pojo.Clinicdepartment;
import com.guigu.liuyunan.pojo.Diseaselibrary;
import com.guigu.liuyunan.pojo.LYNPageVo;
import com.guigu.liuyunan.service.DiseaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DiseaseServiceImpl implements DiseaseService {

    @Autowired
    DiseaselibraryMapper dm;


    @Override
    public PageInfo<Diseaselibrary> DiseaseInfo(LYNPageVo pageVo) {
        PageHelper.startPage(pageVo.getPage(), pageVo.getNum());
        List<Diseaselibrary> diseaselibraries = dm.DiseaseInfo(pageVo);
        return new PageInfo(diseaselibraries);

    }


    @Autowired
    ClinicdepartmentMapper cm;

    @Override
    public List<Clinicdepartment> ClinicdepartmentInfo() {
        return cm.ClinicdepartmentInfo();
    }

    @Override
    public int delDisease(Integer id) {
        return dm.deleteByPrimaryKey(id);
    }

    @Override
    public int AddDisease(Diseaselibrary diseaselibrary) {
        return dm.insert(diseaselibrary);
    }

    @Override
    public int UpDisease(Diseaselibrary diseaselibrary) {
        return dm.updateByPrimaryKey(diseaselibrary);
    }
}
